package com.qh.physicsexperiment.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qh.physicsexperiment.domin.Experiment;
import com.qh.physicsexperiment.mapper.ExperimentMapper;
import com.qh.physicsexperiment.service.ExperimentService;
import com.qh.physicsexperiment.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExperimentServiceImpl extends ServiceImpl<ExperimentMapper, Experiment> implements ExperimentService {
    @Autowired
    private ExperimentMapper experimentMapper;

    @Override
    public List<Experiment> selectAll() {
//        https://blog.csdn.net/weixin_35749545/article/details/129587852
        return experimentMapper.selectList(new QueryWrapper<Experiment>());
    }

    @Override
    public Result findbyid(Integer id) {
        List<Experiment> experiments = (List<Experiment>) experimentMapper.selectById(id);
        return Result.success(experiments);
    }

}
